/**
 * Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 *
 * For the applicable distribution terms see the license.txt -file, included in
 * the distribution.
 */

#include <QtGui/QApplication>
#include <QGraphicsObject>

#ifndef QT_NO_OPENGL
#include <QGLWidget>
#endif

#include "qmlapplicationviewer.h"
#include "box2dplugin.h"
#include "myqmlapplicationviewer.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    Box2DPlugin plugin;
    plugin.registerTypes("Box2D");

    MyQmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.setAttribute(Qt::WA_NoSystemBackground);

#ifndef QT_NO_OPENGL
    // Use QGLWidget to get the opengl support if available
    QGLFormat format = QGLFormat::defaultFormat();
    format.setSampleBuffers(false);

    QGLWidget *glWidget = new QGLWidget(format);
    glWidget->setAutoFillBackground(false);
    viewer.setViewport(glWidget);     // ownership of glWidget is taken
#endif

    viewer.showSplashScreen();

    return app.exec();
}
